function UI_Tree(id,data){
	var arraydata = new Array();
if(data instanceof Array){
	//alert("2");
	//arraydata.push(data);
	//alert(arraydata);
};
 var $this=this;
 var objJquery = jQuery("#"+id);
// var $this1 = $("#"+id1);

	       
            var t_url = objJquery.attr("url"); 
            var t_checkbox =objJquery.attr("checkbox"); 
            var t_cascadeCheck =objJquery.attr("cascadeCheck"); 
			var t_beginEdit = objJquery.attr("beginEdit");
			objJquery.tree({
				//checkbox : true,
				//cascadeCheck : false,
				lines: true,
				data : data,
                checkbox :(t_checkbox==undefined || t_checkbox=="true") ?true:false, 
                cascadeCheck :(t_cascadeCheck==undefined || t_cascadeCheck=="true") ?true:false,
				onClick:function(node){

				objJquery.tree('toggle', node.target);



			//if (node){
			//	objJquery.tree('getChildren', node.target);
			//} else {
			//	objJquery.tree('getChildren');
			//}
					//if(t_beginEdit=="true")
				//	objJquery.tree('beginEdit', node.target);
					
				}
		/**		onContextMenu: function(e, node){
					e.preventDefault();
					$this.tree('select', node.target);
					$this1.menu('show', {
					left: e.pageX,
					top: e.pageY
			        });
				}*/
			});
		
		this.reload=function(){
			var node = objJquery.tree('getSelected');
			if (node){
				objJquery.tree('reload', node.target);
			} else {
				objJquery.tree('reload');
			}
		}
		this.getChildren=function (){
			var node = objJquery.tree('getSelected');
			if (node){
				var children = objJquery.tree('getChildren', node.target);
			} else {
				var children = objJquery.tree('getChildren');
			}
			var s = '';
			for(var i=0; i<children.length; i++){
				s += children[i].text + ',';
			}
			//alert(s);
			return s;
		}
		this.getChecked=function (){
			var nodes = objJquery.tree('getChecked');
			var s = '';
			for(var i=0; i<nodes.length; i++){
				if (s != '') s += ',';
				s += nodes[i].text;
			}
			//alert(s);
			return s;
		}
		this.getSelectId=function (){
			var node = objJquery.tree('getSelected');
			if(node){
				//alert(node.id);
				return node.id;
			}else{
			    //alert("");
				return "";
			}
			
		}

this.getSelectText=function (){
			var node = objJquery.tree('getSelected');
			if(node){
				//alert(node.text);
				return node.text;
			}else{
			    //alert("");
				return "";
			}
			
		}

this.getValue=function (){
			var val = objJquery.combotree('getValue');
			//alert(val);
			return val;
		}



		this.collapse=function (){
			var node = objJquery.tree('getSelected');
			objJquery.tree('collapse',node.target);
		}
		this.expand=function (){
			var node = objJquery.tree('getSelected');
			objJquery.tree('expand',node.target);
		}
		this.collapseAll=function (){
			var node = objJquery.tree('getSelected');
			if (node){
				objJquery.tree('collapseAll', node.target);
			} else {
				objJquery.tree('collapseAll');
			}
		}
		this.expandAll=function (){
			var node =objJquery.tree('getSelected');
			if (node){
				objJquery.tree('expandAll', node.target);
			} else {
				objJquery.tree('expandAll');
			}
		}
	/**	function append(){
			var node =$this.tree('getSelected');
			$this.tree('append',{
				parent: (node?node.target:null),
				data:[{
					text:'new1',
					checked:true
				},{
					text:'new2',
					state:'closed',
					children:[{
						text:'subnew1'
					}]
				}]
			});
		}
		function remove(){
			var node = $this.tree('getSelected');
			$this.tree('remove', node.target);
		}
		function update(){
			var node = objJquery.tree('getSelected');
			if (node){
				node.text = '<span style="font-weight:bold">new text</span>';
				node.iconCls = 'icon-save';
				objJquery.tree('update', node);
			}
		}*/
		this.isLeaf=function (){
			var node =objJquery.tree('getSelected');
			var b = objJquery.tree('isLeaf', node.target);
			return b;
			//alert(b)
		}


}

